<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	 <input type="text" name="" >
    <button onclick="get()">点击随机抽取</button>

    <script type="text/javascript"> 
        // 定义名字数组
        let arr = ["熊大", "熊二", "光头强", "吉吉国王"];
        let inp = document.querySelector("input")
        
        function get() {
            // 生成随机索引
            console.log(Math.random() * arr.length);
            let num = parseInt(Math.random()*arr.length)
            inp.value = arr[num]
        }
    </script>
</body>
</html>